package test;

import java.awt.Color;
import java.awt.DisplayMode;
import java.awt.Font;
import java.awt.Graphics;

import javax.swing.JFrame;

public class FullScreenDemo extends JFrame {
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	public static void main(String[]args)
	{
		DisplayMode displayMode;
		
		if(args.length==3)
		{
			displayMode =new DisplayMode(
					Integer.parseInt(args[0]),
					Integer.parseInt(args[1]),
					Integer.parseInt(args[3]),
					DisplayMode.REFRESH_RATE_UNKNOWN
					);
		}
		else
		{
			displayMode=new DisplayMode(800,600,32,DisplayMode.REFRESH_RATE_UNKNOWN);
		}
		FullScreenDemo test=new FullScreenDemo();
		test.run(displayMode);
	}
	private static final long DEMO_TIME=5000;
	public void run(DisplayMode displayMode)
	{
		setBackground(Color.blue);
		setForeground(Color.white);
		setFont(new Font("Dialog",Font.PLAIN,24));
		
		SimpleScreenManager screen=new SimpleScreenManager();
		try{
			Thread.sleep(DEMO_TIME);
			
		}
		catch(InterruptedException ex)
		{
			
		}
		finally{
			screen.restoreScreen();
		}
	}
	public void paint(Graphics g)
	{
		g.drawString("Hello word!", 20, 50);
	}

}
